/*
 * SplitMergeAction.java
 *
 * Created on June 9, 2002, 1:59 PM
 */

package com.scalar.chiptrack.operations.splitmerge.actions;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.scalar.chiptrack.ChipTrackAction;
import com.scalar.chiptrack.db.DBTransaction;
import com.scalar.chiptrack.operations.splitmerge.dao.SplitMergeDAO;
import com.scalar.chiptrack.operations.splitmerge.forms.SplitMergeForm;

/**
 *
 * @author  Mallikarjun
 * @version 1.0
 */
public class SplitMergeAction extends ChipTrackAction{

   public ActionForward execute (ActionMapping mapping,
                                      ActionForm form,
                                      HttpServletRequest request,
                                      HttpServletResponse response) 
                                      throws Exception {

            SplitMergeForm splitMergeForm = (SplitMergeForm)form;
            DBTransaction dbt = null;
            boolean success = false;
            
            try{
                
                dbt = DBTransaction.getInstance();
                dbt.begin();
                SplitMergeDAO.getSplitMergeInfo(dbt);
                
                success = true;
                
            }catch(Exception e){
                e.printStackTrace();
            }finally{
                if(success){
                    dbt.commit();
                }else{
                    dbt.rollback();
                }
            }
            
            return null;
       }

}
